﻿
////////////////////////////////////////////////////////////////////////////////////////////
// 文件名: ETLTaskBLL.gen.cs
//
// 模块名称: ETLTaskBLL
//
// 作者: yqf
//
// 历史记录（记录修改记录，修改文件后请添加修改记录，注明修改时间、修改人，修改内容）:
// 2013-01-22    yqf    创建文件
////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Data;
using System.Data.Common;
using System.Text;
using Model;
using DAL;
using Common;
using System.Collections.Generic;
using System.Data.SqlClient;

namespace BLL
{
    /// <summary>
    /// ETLTask  表业务逻辑层
    /// </summary>
    public partial class Sys_LogBLL : BaseBLL
    {
        public Sys_LogBLL(LoginInfo info)
        {
            loginInfo = info;
        } 
        /// <summary>
        /// 根据ID字段获取Sys_Log实体对象
        /// </summary>
        /// <param name="ID">ID</param>
        /// <returns>Sys_Log实体对象</returns>
        public Sys_Log GetInfoById(string ID)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                return dal.GetInfoById(ID);
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "GetInfo", AppError.EROR, 0, ex, "获取Sys_Log信息出错。",
                                String.Format("ID = {0}", ID));
                return new Sys_Log();
            }
        }
        /// <summary>
        /// 根据sqlparams获取Sys_Log实体对象
        /// </summary>
        /// SqlParameter[] sqlparams</param>
        /// <returns>Sys_Log实体对象列表</returns>
        public List<Sys_Log> GetList(string sql,IDataParameter[] sqlparams = null)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                return dal.GetList(sql,sqlparams);
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "GetInfoList", AppError.EROR, 0, ex, "获取Sys_Log信息出错。", "");
                return new List<Sys_Log>();
            }
        }
        public int GetListCount(string sql, IDataParameter[] sqlparams)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                return dal.GetListCount(sql, sqlparams);
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "GetListCount", AppError.EROR, 0, ex, "获取Sys_Log实体数量出错。", "");
                return 0;
            }
        }
        /// <summary>
        /// 清除Sys_Log信息
        /// </summary> 
        public string ClearLog(string opUser, string date)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                if (dal.ClearLog(opUser, date))
                {
                    return "1";
                }
                else
                    return "0";
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "ClearLog", AppError.EROR, 0, ex, "清除Sys_Log信息出错。", "");
                return ex.Message;
            }
        }
        public Sys_Log GetLogInfo(string opUser)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                return dal.GetLogInfo(opUser);
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "ClearLog", AppError.EROR, 0, ex, "清除Sys_Log信息出错。", "");
                return new Sys_Log();
            }
        }

        /// <summary>
        /// 根据ID字段获取Sys_DQLog实体对象
        /// </summary>
        /// <param name="ID">ID</param>
        /// <returns>Sys_DQLog实体对象</returns>
        public Sys_DQLog GetDQInfoById(string ID)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                return dal.GetDQInfoById(ID);
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "GetDQInfo", AppError.EROR, 0, ex, "获取Sys_DQLog信息出错。",
                                String.Format("ID = {0}", ID));
                return new Sys_DQLog();
            }
        }
        /// <summary>
        /// 根据sqlparams 获取Sys_DQLog实体对象
        /// </summary>
        /// SqlParameter[] sqlparams</param>
        /// <returns>Sys_DQLog实体对象列表</returns>
        public List<Sys_DQLog> GetDQList(string sql,IDataParameter[] sqlparams = null)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                return dal.GetDQList(sql,sqlparams);
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "GetDQInfoList", AppError.EROR, 0, ex, "获取Sys_DQLog信息出错。", "");
                return new List<Sys_DQLog>();
            }
        }
        public int GetDQListCount(string sql,IDataParameter[] sqlparams)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                return dal.GetDQListCount(sql, sqlparams);
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "GetDQListCount", AppError.EROR, 0, ex, "获取Sys_DQLog实体数量出错。", "");
                return 0;
            }
        }
        /// <summary>
        /// 清除Sys_Log信息
        /// </summary> 
        public string ClearDQLog(string opUser, string date)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                if (dal.ClearDQLog(opUser, date))
                {
                    return "1";
                }
                else
                    return "0";
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "ClearDQLog", AppError.EROR, 0, ex, "清除Sys_DQLog信息出错。", "");
                return ex.Message;
            }
        }

        public string ClearETLLog(string date)
        {
            try
            {
                Sys_LogDAL dal = new Sys_LogDAL(loginInfo);
                if (dal.ClearETLLog(date))
                {
                    return "1";
                }
                else
                    return "0";
            }
            catch (Exception ex)
            {
                Logger.LogError("Sys_LogBLL", "ETL_Log", AppError.EROR, 0, ex, "清除ETL_Log信息出错。", "");
                return ex.Message;
            }
        }
    }
}